Ref-sink the tooltips object. Ref-sink the tooltips object. Fix some
authorOwen Taylor <otaylor@redhat.com>
Wed, 21 Nov 2001 17:04:35 +0000 (17:04 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Wed, 21 Nov 2001 17:04:35 +0000 (17:04 +0000)
Wed Nov 21 11:41:29 2001  Owen Taylor  <otaylor@redhat.com>
* tests/testgtk.c (create_tooltips): Ref-sink the tooltips object.
* gtk/gtktoolbar.c (gtk_toolbar_init): Ref-sink the tooltips object.
* gtk/gtkfilesel.c (open_new_dir): Fix some constness warnings.
* gtk/gtkaccelgroup.c: Rename gtk_accel_groups_from_acceleratable()
back to gtk_accel_groups_from_object(), change @acceleratable
parameter to gtk_accel_groups_activate() accordingly.
* gtk/gtkaccelmap.c (gtk_accel_map_lookup_entry): Remove
left-over comment about quark return.
* gtk/gtkaccelmap.h: Fix spelling of gtk_accel_map_foreach_unfiltered().
  * gtk/gtk-boxed.defs (GtkIconSource): added as a boxed type.
        (Patch from Matt Wilson)
* gtk/gtkobject.c (gtk_object_finalize): Warn if a floating
object is finalized.

16 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtk-boxed.defs
gtk/gtkaccelgroup.c
gtk/gtkaccelgroup.h
gtk/gtkaccelmap.c
gtk/gtkaccelmap.h
gtk/gtkfilesel.c
gtk/gtkobject.c
gtk/gtktoolbar.c
tests/testgtk.c

index fb08736ec1762f6d46a29fce082077adac127908..b5641e14f8781a4ca1b9eee0c2ceefc3229a1fe4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+Wed Nov 21 11:41:29 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * tests/testgtk.c (create_tooltips): Ref-sink the tooltips object.
+
+       * gtk/gtktoolbar.c (gtk_toolbar_init): Ref-sink the tooltips object.
+
+       * gtk/gtkfilesel.c (open_new_dir): Fix some constness warnings.
+
+       * gtk/gtkaccelgroup.c: Rename gtk_accel_groups_from_acceleratable()
+       back to gtk_accel_groups_from_object(), change @acceleratable
+       parameter to gtk_accel_groups_activate() accordingly.
+
+       * gtk/gtkaccelmap.c (gtk_accel_map_lookup_entry): Remove
+       left-over comment about quark return.
+
+       * gtk/gtkaccelmap.h: Fix spelling of gtk_accel_map_foreach_unfiltered().
+
+       * gtk/gtk-boxed.defs (GtkIconSource): added as a boxed type.
+        (Patch from Matt Wilson)
+
+       * gtk/gtkobject.c (gtk_object_finalize): Warn if a floating
+       object is finalized.
+
 Tue Nov 20 21:25:08 2001  Tim Janik  <timj@gtk.org>
 
        * applied patch from owen to get rid of accel map notifiers.
index fb08736ec1762f6d46a29fce082077adac127908..b5641e14f8781a4ca1b9eee0c2ceefc3229a1fe4 100644 (file)
@@ -1,3 +1,26 @@
+Wed Nov 21 11:41:29 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * tests/testgtk.c (create_tooltips): Ref-sink the tooltips object.
+
+       * gtk/gtktoolbar.c (gtk_toolbar_init): Ref-sink the tooltips object.
+
+       * gtk/gtkfilesel.c (open_new_dir): Fix some constness warnings.
+
+       * gtk/gtkaccelgroup.c: Rename gtk_accel_groups_from_acceleratable()
+       back to gtk_accel_groups_from_object(), change @acceleratable
+       parameter to gtk_accel_groups_activate() accordingly.
+
+       * gtk/gtkaccelmap.c (gtk_accel_map_lookup_entry): Remove
+       left-over comment about quark return.
+
+       * gtk/gtkaccelmap.h: Fix spelling of gtk_accel_map_foreach_unfiltered().
+
+       * gtk/gtk-boxed.defs (GtkIconSource): added as a boxed type.
+        (Patch from Matt Wilson)
+
+       * gtk/gtkobject.c (gtk_object_finalize): Warn if a floating
+       object is finalized.
+
 Tue Nov 20 21:25:08 2001  Tim Janik  <timj@gtk.org>
 
        * applied patch from owen to get rid of accel map notifiers.
index fb08736ec1762f6d46a29fce082077adac127908..b5641e14f8781a4ca1b9eee0c2ceefc3229a1fe4 100644 (file)
@@ -1,3 +1,26 @@
+Wed Nov 21 11:41:29 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * tests/testgtk.c (create_tooltips): Ref-sink the tooltips object.
+
+       * gtk/gtktoolbar.c (gtk_toolbar_init): Ref-sink the tooltips object.
+
+       * gtk/gtkfilesel.c (open_new_dir): Fix some constness warnings.
+
+       * gtk/gtkaccelgroup.c: Rename gtk_accel_groups_from_acceleratable()
+       back to gtk_accel_groups_from_object(), change @acceleratable
+       parameter to gtk_accel_groups_activate() accordingly.
+
+       * gtk/gtkaccelmap.c (gtk_accel_map_lookup_entry): Remove
+       left-over comment about quark return.
+
+       * gtk/gtkaccelmap.h: Fix spelling of gtk_accel_map_foreach_unfiltered().
+
+       * gtk/gtk-boxed.defs (GtkIconSource): added as a boxed type.
+        (Patch from Matt Wilson)
+
+       * gtk/gtkobject.c (gtk_object_finalize): Warn if a floating
+       object is finalized.
+
 Tue Nov 20 21:25:08 2001  Tim Janik  <timj@gtk.org>
 
        * applied patch from owen to get rid of accel map notifiers.
index fb08736ec1762f6d46a29fce082077adac127908..b5641e14f8781a4ca1b9eee0c2ceefc3229a1fe4 100644 (file)
@@ -1,3 +1,26 @@
+Wed Nov 21 11:41:29 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * tests/testgtk.c (create_tooltips): Ref-sink the tooltips object.
+
+       * gtk/gtktoolbar.c (gtk_toolbar_init): Ref-sink the tooltips object.
+
+       * gtk/gtkfilesel.c (open_new_dir): Fix some constness warnings.
+
+       * gtk/gtkaccelgroup.c: Rename gtk_accel_groups_from_acceleratable()
+       back to gtk_accel_groups_from_object(), change @acceleratable
+       parameter to gtk_accel_groups_activate() accordingly.
+
+       * gtk/gtkaccelmap.c (gtk_accel_map_lookup_entry): Remove
+       left-over comment about quark return.
+
+       * gtk/gtkaccelmap.h: Fix spelling of gtk_accel_map_foreach_unfiltered().
+
+       * gtk/gtk-boxed.defs (GtkIconSource): added as a boxed type.
+        (Patch from Matt Wilson)
+
+       * gtk/gtkobject.c (gtk_object_finalize): Warn if a floating
+       object is finalized.
+
 Tue Nov 20 21:25:08 2001  Tim Janik  <timj@gtk.org>
 
        * applied patch from owen to get rid of accel map notifiers.
index fb08736ec1762f6d46a29fce082077adac127908..b5641e14f8781a4ca1b9eee0c2ceefc3229a1fe4 100644 (file)
@@ -1,3 +1,26 @@
+Wed Nov 21 11:41:29 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * tests/testgtk.c (create_tooltips): Ref-sink the tooltips object.
+
+       * gtk/gtktoolbar.c (gtk_toolbar_init): Ref-sink the tooltips object.
+
+       * gtk/gtkfilesel.c (open_new_dir): Fix some constness warnings.
+
+       * gtk/gtkaccelgroup.c: Rename gtk_accel_groups_from_acceleratable()
+       back to gtk_accel_groups_from_object(), change @acceleratable
+       parameter to gtk_accel_groups_activate() accordingly.
+
+       * gtk/gtkaccelmap.c (gtk_accel_map_lookup_entry): Remove
+       left-over comment about quark return.
+
+       * gtk/gtkaccelmap.h: Fix spelling of gtk_accel_map_foreach_unfiltered().
+
+       * gtk/gtk-boxed.defs (GtkIconSource): added as a boxed type.
+        (Patch from Matt Wilson)
+
+       * gtk/gtkobject.c (gtk_object_finalize): Warn if a floating
+       object is finalized.
+
 Tue Nov 20 21:25:08 2001  Tim Janik  <timj@gtk.org>
 
        * applied patch from owen to get rid of accel map notifiers.
index fb08736ec1762f6d46a29fce082077adac127908..b5641e14f8781a4ca1b9eee0c2ceefc3229a1fe4 100644 (file)
@@ -1,3 +1,26 @@
+Wed Nov 21 11:41:29 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * tests/testgtk.c (create_tooltips): Ref-sink the tooltips object.
+
+       * gtk/gtktoolbar.c (gtk_toolbar_init): Ref-sink the tooltips object.
+
+       * gtk/gtkfilesel.c (open_new_dir): Fix some constness warnings.
+
+       * gtk/gtkaccelgroup.c: Rename gtk_accel_groups_from_acceleratable()
+       back to gtk_accel_groups_from_object(), change @acceleratable
+       parameter to gtk_accel_groups_activate() accordingly.
+
+       * gtk/gtkaccelmap.c (gtk_accel_map_lookup_entry): Remove
+       left-over comment about quark return.
+
+       * gtk/gtkaccelmap.h: Fix spelling of gtk_accel_map_foreach_unfiltered().
+
+       * gtk/gtk-boxed.defs (GtkIconSource): added as a boxed type.
+        (Patch from Matt Wilson)
+
+       * gtk/gtkobject.c (gtk_object_finalize): Warn if a floating
+       object is finalized.
+
 Tue Nov 20 21:25:08 2001  Tim Janik  <timj@gtk.org>
 
        * applied patch from owen to get rid of accel map notifiers.
index fb08736ec1762f6d46a29fce082077adac127908..b5641e14f8781a4ca1b9eee0c2ceefc3229a1fe4 100644 (file)
@@ -1,3 +1,26 @@
+Wed Nov 21 11:41:29 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * tests/testgtk.c (create_tooltips): Ref-sink the tooltips object.
+
+       * gtk/gtktoolbar.c (gtk_toolbar_init): Ref-sink the tooltips object.
+
+       * gtk/gtkfilesel.c (open_new_dir): Fix some constness warnings.
+
+       * gtk/gtkaccelgroup.c: Rename gtk_accel_groups_from_acceleratable()
+       back to gtk_accel_groups_from_object(), change @acceleratable
+       parameter to gtk_accel_groups_activate() accordingly.
+
+       * gtk/gtkaccelmap.c (gtk_accel_map_lookup_entry): Remove
+       left-over comment about quark return.
+
+       * gtk/gtkaccelmap.h: Fix spelling of gtk_accel_map_foreach_unfiltered().
+
+       * gtk/gtk-boxed.defs (GtkIconSource): added as a boxed type.
+        (Patch from Matt Wilson)
+
+       * gtk/gtkobject.c (gtk_object_finalize): Warn if a floating
+       object is finalized.
+
 Tue Nov 20 21:25:08 2001  Tim Janik  <timj@gtk.org>
 
        * applied patch from owen to get rid of accel map notifiers.
index 1f1a997b5c9d4da76ec4f392176d0d57c393afa1..fce86868162782494dd94870fc6c8ba7f1c42d71 100644 (file)
   gtk_icon_set_unref
   "sizeof(GtkIconSet)")
 
+(define-boxed GtkIconSource
+  gtk_icon_source_copy
+  gtk_icon_source_free
+  "sizeof(GtkIconSource)")
+
 ;; TextView
 
 (define-boxed GtkTextIter
index 8106f813e1837e2c35495722e8c51ea766fc0639..a5029432232bebae99b7f1a082e5a8f4033fecb3 100644 (file)
@@ -242,7 +242,7 @@ _gtk_accel_group_detach (GtkAccelGroup *accel_group,
 }
 
 GSList*
-gtk_accel_groups_from_acceleratable (GObject *object)
+gtk_accel_groups_from_object (GObject *object)
 {
   g_return_val_if_fail (G_IS_OBJECT (object), NULL);
   
@@ -706,23 +706,24 @@ _gtk_accel_group_activate (GtkAccelGroup  *accel_group,
 
 /**
  * gtk_accel_groups_activate:
- * @acceleratable: usually a #GtkWindow
+ * @object:        the #Gobject, usually a #GtkWindow, on which
+ *                 to activate the accelerator.
  * @accel_key:     accelerator keyval from a key event
  * @accel_mods:    keyboard state mask from a key event
  * @returns:       %TRUE if the accelerator was handled, %FALSE otherwise
  * 
  * Finds the first accelerator in any #GtkAccelGroup attached
- * to @acceleratable that matches @accel_key and @accel_mods, and
+ * to @object that matches @accel_key and @accel_mods, and
  * activates that accelerator.
  * If an accelerator was activated and handled this keypress, %TRUE
  * is returned.
  */
 gboolean
-gtk_accel_groups_activate (GObject       *acceleratable,
+gtk_accel_groups_activate (GObject       *object,
                           guint           accel_key,
                           GdkModifierType accel_mods)
 {
-  g_return_val_if_fail (G_IS_OBJECT (acceleratable), FALSE);
+  g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
   
   if (gtk_accelerator_valid (accel_key, accel_mods))
     {
@@ -734,8 +735,8 @@ gtk_accel_groups_activate (GObject    *acceleratable,
       accel_quark = g_quark_from_string (accel_name);
       g_free (accel_name);
       
-      for (slist = gtk_accel_groups_from_acceleratable (acceleratable); slist; slist = slist->next)
-       if (_gtk_accel_group_activate (slist->data, accel_quark, acceleratable, accel_key, accel_mods))
+      for (slist = gtk_accel_groups_from_object (object); slist; slist = slist->next)
+       if (_gtk_accel_group_activate (slist->data, accel_quark, object, accel_key, accel_mods))
          return TRUE;
     }
   
index cfb207f8a7d2e41b38e7524134fd4d56a781c956..47d50cebae92d34660e635f38a5f37071c56dbab 100644 (file)
@@ -112,10 +112,10 @@ void              _gtk_accel_group_attach         (GtkAccelGroup  *accel_group,
                                                 GObject        *object);
 void           _gtk_accel_group_detach         (GtkAccelGroup  *accel_group,
                                                 GObject        *object);
-gboolean        gtk_accel_groups_activate              (GObject        *acceleratable,
+gboolean        gtk_accel_groups_activate              (GObject        *object,
                                                 guint           accel_key,
                                                 GdkModifierType accel_mods);
-GSList*            gtk_accel_groups_from_acceleratable (GObject        *object);
+GSList*                gtk_accel_groups_from_object    (GObject        *object);
 GtkAccelKey*   gtk_accel_group_find            (GtkAccelGroup  *accel_group,
                                                 gboolean (*find_func) (GtkAccelKey *key,
                                                                        GClosure    *closure,
index 7fe375c606e9574b08367c86a85bd869ac260aa9..00131a5bb522bc13dcbe81cc1d6971ad261739f5 100644 (file)
@@ -169,9 +169,7 @@ gtk_accel_map_add_entry (const gchar *accel_path,
  * @key:         accelerator key to be filled in (optional)
  * @returns:     %TRUE if @accel_path is known, %FALSE otherwise
  *
- * Lookup the accelerator entry for @accel_path and fill in @key.
- * If the lookup revealed no results, (0) is returned, the entry's
- * #GQuark otherwise.
+ * Looks up the accelerator entry for @accel_path and fills in @key.
  */
 gboolean
 gtk_accel_map_lookup_entry (const gchar *accel_path,
@@ -279,7 +277,7 @@ internal_change_entry (const gchar    *accel_path,
   win_list = g_hash_table_slist_values (win_hm);
   g_hash_table_destroy (win_hm);
   for (slist = win_list; slist; slist = slist->next)
-    for (node = gtk_accel_groups_from_acceleratable (slist->data); node; node = node->next)
+    for (node = gtk_accel_groups_from_object (slist->data); node; node = node->next)
       g_hash_table_insert (group_hm, node->data, node->data);
   group_list = g_hash_table_slist_values (group_hm);
   g_hash_table_destroy (group_hm);
index 7a59b2d808079a7e0ed3277bcc32f490b9bc9b3d..7321079ed656cca63d7801cdd8e58ab0cf540854 100644 (file)
@@ -53,9 +53,9 @@ void     gtk_accel_map_save_fd        (gint                    fd);
 
 
 /* --- filter functions --- */
-void   gtk_accel_map_add_filter        (const gchar            *filter_pattern);
-void   gtk_accel_map_foreach_unfilterd (gpointer                data,
-                                        GtkAccelMapForeach      foreach_func);
+void   gtk_accel_map_add_filter         (const gchar           *filter_pattern);
+void   gtk_accel_map_foreach_unfiltered (gpointer               data,
+                                         GtkAccelMapForeach     foreach_func);
 
 
 /* --- internal API --- */
index 19fb7ab9e823a1e4977f6213d6434d3e50c26bbd..1190154c4e01dcaccc13b60eb520ae0b406aa2e6 100644 (file)
@@ -2590,7 +2590,7 @@ open_new_dir (gchar       *dir_name,
 {
   CompletionDirSent *sent;
   GDir *directory;
-  char *dirent;
+  const char *dirent;
   GError *error;
   gint entry_count = 0;
   gint n_entries = 0;
index 0c47368369bab3da101c5f9397414a3b4e9e5d1c..70e1eda4a79c966c82f1a75afd1cd4d66cf8c159 100644 (file)
@@ -389,6 +389,15 @@ gtk_object_finalize (GObject *gobject)
 {
   GtkObject *object = GTK_OBJECT (gobject);
 
+  if (GTK_OBJECT_FLOATING (object))
+    {
+      g_warning ("A floating object was finalized. This means that someone\n"
+                "called g_object_unref() on an object that had only a floating\n"
+                "reference; the initial floating reference is not owned by anyone\n"
+                "and must be removed with gtk_object_sink() after a normal\n"
+                "reference is obtained with g_object_ref().");
+    }
+  
   gtk_object_notify_weaks (object);
   
   G_OBJECT_CLASS (parent_class)->finalize (gobject);
index 7bf325e2d71e9df7352c7a63049acc6f720827d0..9ee939a72dff237181a75da0af7a85d42cd936e3 100644 (file)
@@ -340,6 +340,9 @@ gtk_toolbar_init (GtkToolbar *toolbar)
   toolbar->orientation  = GTK_ORIENTATION_HORIZONTAL;
   toolbar->icon_size    = DEFAULT_ICON_SIZE;
   toolbar->tooltips     = gtk_tooltips_new ();
+  g_object_ref (toolbar->tooltips);
+  gtk_object_sink (GTK_OBJECT (toolbar->tooltips));
+  
   toolbar->button_maxw  = 0;
   toolbar->button_maxh  = 0;
 
index 8f22c514dccd82802ad3dc1f28e3f8a4f8faf22e..f893412e7222c2ffcad4be0815161af5429b1935 100644 (file)
@@ -2823,6 +2823,8 @@ create_tooltips (void)
                           &window);
 
       tooltips=gtk_tooltips_new();
+      g_object_ref (tooltips);
+      gtk_object_sink (GTK_OBJECT (tooltips));
       gtk_object_set_data (GTK_OBJECT (window), "tooltips", tooltips);
       
       box1 = gtk_vbox_new (FALSE, 0);